<script type="text/javascript">
	function onlyNumbers(evt) 
	{
		evt = (evt) ? evt : window.event
		var charCode = (evt.which) ? evt.which : evt.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57)) {
			//status = "This field accepts numbers only."
			alert("Harus di Isi Angka");
			return false
		}
		//status = ""
		return true 	
	}
</script>
<form method="post" name="frmSearch" action="<?php echo site_url('mastersuppliercontroller');?>">
    <table width="100%" cellpadding="3" cellspacing="0" border="1">
        <tr>
            <td width="125"><strong>Pilih Search</strong></td>
            <td width="19" align="center"><strong>:</strong></td>
            <td width="843" colspan="3">
                <select name="kdsuppview">
                    <option value="0">Pilih</option>
                    <option value="1">Kode Supplier</option>
                    <option value="2">Nama Supplier</option>
                    <option value="3">Nama Web Site</option>
                </select> &nbsp;|&nbsp;<input type="text"  name="suppview" id="suppview" size="50" />&nbsp;|&nbsp;<input type="submit" name="btnview" value="Search">
            </td>
		</tr>
    </table>
</form>
<br />
<form method="post" name="frmSearch" action="<?php echo site_url('mastersuppliercontroller/tambahmastersupplier');?>">
    <table width="100%" cellpadding="3" cellspacing="0" border="1">
    	<tr style="background-color:#FFF; color:#000000;" align="center">
        	<td colspan="3" height="25"><strong>INPUT DAFTAR SUPPLIER</strong></td>
    	</tr>
        <tr >
        	<td colspan="3" height="25">&nbsp;</td>
    	</tr>
        <tr>
            <td width="121"><strong>Kode Supplier</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td width="823" colspan="3"><input type="text"  name="kdsupp" id="kdsupp" maxlength="12" size="25" value="{SupplierCode}" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="121"><strong>Nama Supplier</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="nmsupp" id="nmsupp" size="50" maxlength="100"/></td>
        </tr>
        <tr>
            <td width="121"><strong>Alamat</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="alamat" id="alamat" size="100" /></td>
        </tr>
        <tr>
            <td width="121"><strong>Contact Person</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="contact" id="contact" size="35" maxlength="50"/></td>
        </tr>
        <tr>
            <td width="121"><strong>Email</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="email" id="email" size="35" maxlength="100"/></td>
        </tr>
        <tr>
            <td width="121"><strong>No Telepon</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td >+62 <input type="text"  name="notlp" id="notlp" size="30" maxlength="15" onkeypress="return onlyNumbers(event);" /></td>
        </tr>
        <tr>
            <td width="121"><strong>No HandPhone</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td >+62 <input type="text"  name="nohp" id="nohp" size="30" maxlength="15" onkeypress="return onlyNumbers(event);" /></td>
        </tr>
        <tr>
            <td width="121"><strong>Nama Web Site</strong></td>
            <td width="27" align="center"><strong>:</strong></td>
            <td ><input type="text"  name="nmaweb" id="nmaweb" size="35" maxlength="50" /></td>
        </tr>
        <tr>
            <td colspan="3" align="center"><input type="submit" value="Save" name="btnSave" >&nbsp;<input type="button" name="btnClose" value="Back" class="btn" onclick="javascript:window.location='<?php echo site_url('menuhomecontroller'); ?>';" /></td>
        </tr>
    </table>
</form>
<br />
<br />
<div class="cleaner_h10"></div>
<table border="1" cellpadding="3" cellspacing="0" width="100%" style=" border-collapse: collapse;" class="record" bordercolor="#CCCCCC">
    <tr style="background-color:#FFF; color:#000000;" align="center">
        <td colspan="9" height="25"><strong>LIST DAFTAR SUPPLIER</strong></td>
    </tr>
    <tr style="background-color:#333; color:#FFF;" align="center">
        <td>Kode Supplier</td>
        <td>Nama Supplier</td>
        <td>Alamat</td>
        <td>Contact Person</td>
        <td>Email</td>
        <td>No Telepon</td>
        <td>No Handphone</td>
        <td>Web Site</td>
        <td>&nbsp;</td>
    </tr>
	<?php if(count($mastersupp)>0){ ?>
        {mastersupp}
            <tr class="cellDefault">
                <td align="center">{Kodesupplier}</td>
                <td align="center">{suppliername}</td>
                <td align="left">{Address}</td>
                <td align="center">{ContactPerson}</td>
                <td align="center">{Email}</td>
                <td align="center">+ 62 &nbsp;{NoTlp}</td>
                <td align="center">+ 62 &nbsp;{NoHP}</td>
                <td align="center">{Websitename}</td>
                <td align="center">
                	<button onclick="javascript:window.location='<?php echo site_url('mastersuppliercontroller/editSupplier');?>/{Kodesupplier}';" id="edit">Edit</button>
                    <?Php 
						if($this->session->userdata('grade') == 0)
						{
					?>
							&nbsp;|&nbsp;
                            <button id="hapus" onclick="javascript:window.location='<?php echo site_url('mastersuppliercontroller/deletemastersupplier');?>/{Kodesupplier}';">Hapus</button>
					<?php } ?>
				</td>
            </tr>
        {/mastersupp}
    <?php } else{
            echo "<tr>";
            echo "<td colspan='9' style='text-align:center;color:red;'>No Data To Display</td>";
            echo "</tr>";
    } ?>
    <?php if(!empty($message))?>{message}
</table>
<?php echo $links; ?>